angular.module('imsApp').controller('indexesController', ['$scope','SystemManager','$state','ImsAlert','ImsErr', function ($scope,SystemManager,$state,ImsAlert,ImsErr) {
    $scope.createPlanIsShow=false;
    $scope.createAdvIsShow=false;
    $scope.createChannelIsShow=false;
    $scope.createAppIsShow=false;
    $scope.createTagIsShow=false;
    $scope.createPlan=function () {
        $scope.createPlanIsShow=true;
        SystemManager.createPlan().then(function (result) {
            if(result.data.c=="s"){
                $scope.createPlanIsShow=false;

                ImsAlert.open({message:"索引创建成功"}).then(function (a) {
                })
            }else{
                ImsErr.open({message:"索引创建失败"}).then(function (a) {
                })
            }
            $state.reload();
        })

    };
    $scope.createAdv=function () {
        $scope.createAdvIsShow=true;
        SystemManager.createAdv().then(function (result) {
            if(result.data.c=="s"){
                $scope.createAdvIsShow=false;
                ImsAlert.open({message:"索引创建成功"}).then(function (a) {
                })
            }else{
                ImsErr.open({message:"索引创建失败"}).then(function (a) {
                })
            }
            $state.reload();
        })
    };
    $scope.createChannel=function () {
        $scope.createChannelIsShow=true;
        SystemManager.createChannel().then(function (result) {
            if(result.data.c=="s"){
                $scope.createChannelIsShow=false;
                ImsAlert.open({message:"索引创建成功"}).then(function (a) {
                })
            }else{
                ImsErr.open({message:"索引创建失败"}).then(function (a) {
                })
            }
            $state.reload();
        })
    };
    $scope.createApp=function () {
        $scope.createAppIsShow=true;
        SystemManager.createApp().then(function (result) {
            if(result.data.c=="s"){
                $scope.createAppIsShow=false;
                ImsAlert.open({message:"索引创建成功"}).then(function (a) {
                })
            }else{
                ImsErr.open({message:"索引创建失败"}).then(function (a) {
                })
            }
            $state.reload();
        })
    };
    $scope.createTag=function () {
        $scope.createTagIsShow=true;
        SystemManager.createTag().then(function (result) {
            if(result.data.c=="s"){
                $scope.createTagIsShow=false;
                ImsAlert.open({message:"索引创建成功"}).then(function (a) {
                })
            }else{
                ImsErr.open({message:"索引创建失败"}).then(function (a) {
                })
            }
            $state.reload();
        })
    };

}])

